import React, { Component } from 'react'
import './style.css'


export default class ErrorBoundary extends Component {
  state = {
    isError: false
  }
  render() {
    return this.state.isError ? (
      <div>
        <h1>出错了，请重试</h1>
      </div>
    ) : this.props.children;
  }
  componentDidCatch(error){
    
    this.setState({isError: true});
   
  }
}
